<?php
include_once('common/header.php');			
if($AppUI->id <=0 || !isset($_SERVER['HTTP_REFERER'])) {
	Vfriend_Function::redirect(HOST_VFRIEND);
}
$intOfflineId	= $objRequest->getParam('offlineid', 0);
$strToken		= $objRequest->getParam('token', '');
$strSession		= Vfriend_Function::getSecret($intOfflineId, SE_OFFLINE_REGISTER);
$strRefer		= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
$intError		= 0;
if(Vfriend_Function::isValidLink($strRefer) && $strToken != '' && $strToken == $strSession) {
	Vfriend_Function::deleteSecret($intOfflineId, SE_OFFLINE_REGISTER);
	$objOffline = new Offline();
	$intError	= $objOffline->ojoinReg($AppUI->id, $intOfflineId);
	if($intError == 0) {
		Vfriend_Function::setMsg($arrMessage[3]);
	} else {
		$intError += 14;
	}
} else {
	$intError	= 14;
}
if($intError > 0) {	
	Vfriend_Function::setError($arrError[$intError]);	
}
$strRefer	= $strRefer ? $strRefer : LINK_OFFLINE;
Vfriend_Function::redirect($strRefer);
?>